﻿@page "/card/dynamic-update"
@inherits SampleBaseComponent;

@using Syncfusion.Blazor.Cards
@using Syncfusion.Blazor.Buttons

<SampleDescription>
    <p>This sample demonstrates dynamic update for card component.</p>
</SampleDescription>
<ActionDescription>
    <p>Card Header, Image and Footers can be customized in this sample.</p>
</ActionDescription>

<div class="row">
    <div class="control-section col-lg-9">
        <SfCard ID="DynamicCard">
            <CardHeader Title="Robert Jhonson" SubTitle="Chief Executive" />
            @if (IsMedia)
            {
                <CardImage Image="images/cards/robert-jhonson.png" />
            }
            @if (IsText)
            {
                <CardContent Content="Robert received a MBA in Marketing from the University of California. He can able to markert the multiple products. He have experience on 10 years on marketing field." />
            }
            @if (IsFooter)
            {
                <CardFooter>
                    <CardFooterContent Text="Add More" />
                </CardFooter>
            }
        </SfCard>
    </div>
    <div class="col-lg-3 property-section">
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>
        <div class="property-panel-section">
            <div class="property-panel-header">Properties</div>
            <div class="property-panel-content">
                <table class="table">
                    <tr>
                        <td>Card Media</td>
                        <td>
                            <SfCheckBox TChecked="bool" @onchange="@(() => IsMedia = !IsMedia)"></SfCheckBox>
                        </td>
                    </tr>
                    <tr>
                        <td>Card Content</td>
                        <td>
                            <SfCheckBox TChecked="bool" @onchange="@(() => IsText = !IsText)"></SfCheckBox>
                        </td>
                    </tr>
                    <tr>
                        <td>Card Footer</td>
                        <td>
                            <SfCheckBox TChecked="bool" @onchange="@(() => IsFooter = !IsFooter)"></SfCheckBox>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</div>

@code{
    bool IsMedia = false;
    bool IsText = false;
    bool IsFooter = false;
}

<style>
    .col-lg-9 {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    #DynamicCard {
        margin: auto;
        width: 60%
    }

    .control-section {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    td {
        font-size: 14px;
    }

    tr {
        height: 25px;
    }

    .e-card .e-card-image {
        background-repeat: no-repeat;
        background-size: contain;
        min-height: 300px;
    }

    .e-card .e-card-header .e-card-header-caption .e-card-header-title {
        font-size: 20px;
        font-family: Helvetica, 'Segoe UI';
        font-weight: bold;
    }

    .e-card .e-card-header .e-card-header-caption .e-card-sub-title {
        padding-top: 5px;
    }
</style>
